package com.itheima.job;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.service.OrderSettingService;


import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;


public class CleanBeforeTodayJob {

    @Reference
    private OrderSettingService orderSettingService;

    public void clear(){
        Calendar calendar=Calendar.getInstance();
        calendar.add(Calendar.MONTH,-1);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String day = sdf.format(calendar.getTime());
       orderSettingService.cleanBeforeToday(day);
        System.out.println("执行了清除过期数据的方法"+new Date());
    }
}
